package com.demo.yuanzi.service.impl;

import com.demo.yuanzi.dao.YuanziSaRoleDao;
import com.demo.yuanzi.entity.YuanziSaRole;

import com.demo.yuanzi.service.YuanziSaRoleService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;

/**
 * (YuanziSaRole)表服务实现类
 *
 * @author makejava
 * @since 2024-05-09 14:16:53
 */
@Service("yuanziSaRoleService")
public class YuanziSaRoleServiceImpl implements YuanziSaRoleService {
    @Resource
    private YuanziSaRoleDao yuanziSaRoleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public YuanziSaRole queryById(Integer id) {
        return this.yuanziSaRoleDao.queryById(id);
    }



    /**
     * 新增数据
     *
     * @param yuanziSaRole 实例对象
     * @return 实例对象
     */
    @Override
    public YuanziSaRole insert(YuanziSaRole yuanziSaRole) {
        this.yuanziSaRoleDao.insert(yuanziSaRole);
        return yuanziSaRole;
    }

    /**
     * 修改数据
     *
     * @param yuanziSaRole 实例对象
     * @return 实例对象
     */
    @Override
    public YuanziSaRole update(YuanziSaRole yuanziSaRole) {
        this.yuanziSaRoleDao.update(yuanziSaRole);
        return this.queryById(yuanziSaRole.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.yuanziSaRoleDao.deleteById(id) > 0;
    }
}
